package com.bw.day03.adapter

import android.graphics.Color
import android.widget.TextView
import com.bw.base.net.entity.ExplosiveMoney
import com.bw.day03.R
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

class MoneyAdapter:BaseQuickAdapter<ExplosiveMoney,BaseViewHolder>(R.layout.item_money) {
    //分类
    var selectType=4
    override fun convert(holder: BaseViewHolder, item: ExplosiveMoney) {
        holder.setText(R.id.money_info,item.info)
        holder.setText(R.id.money_name,item.name)
        if (selectType==item.type.toInt()){
            holder.getView<TextView>(R.id.money_info).setTextColor(Color.RED)
            holder.getView<TextView>(R.id.money_name).setTextColor(Color.RED)
        }else{
            holder.getView<TextView>(R.id.money_info).setTextColor(Color.BLACK)
            holder.getView<TextView>(R.id.money_name).setTextColor(Color.BLACK)
        }
    }
    fun updateType(type:Int){
        selectType=type
        notifyDataSetChanged()
    }

}